//点击登录出现登录界面
$("#dll").on("click",function(){
	$("#ent").css("display","block")
})
//点击登录界面上的X号，隐藏登录界面
$("#qxx").on("click",function(){
	$("#ent").css("display","none")
})
//点击注册出现登录界面
$("#enroll").on("click",function(){
	$("#zcym").css("display","block")
})
//点击注册界面上的X号，隐藏登录界面
$("#closs").on("click",function(){
	$("#zcym").css("display","none")
})
//-------------------滑入出现---------------
$("#hd01").on("mouseover",function(){
	$("#xiushouji").css("display","block");
})
$("#hd01").on("mouseout",function(){
	$("#xiushouji").css("display","none");
})
$("#hd02").on("mouseover",function(){
	$("#xiudiannao").css("display","block");
})
$("#hd02").on("mouseout",function(){
	$("#xiudiannao").css("display","none");
})
$("#hd03").on("mouseover",function(){
	$("#maishouji").css("display","block");
})
$("#hd03").on("mouseout",function(){
	$("#maishouji").css("display","none");
})
$("#hd04").on("mouseover",function(){
	$("#ershouji").css("display","block");
})
$("#hd04").on("mouseout",function(){
	$("#ershouji").css("display","none");
})
//---------------点击客服出现------------------
$("#zxkf").on("click",function(){
	$(".kf").css("display","block")
})
//--------------点击差号消失-------------------
$(".X2").on("click",function(){
	$(".kf").css("display","none")
})
//----------------二手机----------------------

//----------------------------------------
	if(window.XMLHttpRequest){
		var xhr = new XMLHttpRequest();
	}else{
		var xhr = new ActiveXObject(MSLML2.XMLHttp)
	}
	xhr.open("GET","http://localhost:10020/data/weixiu1.json",true)
	xhr.send()
	xhr.onreadystatechange = function(){
		if(xhr.readyState == 4){
			if(xhr.status >= 200 && xhr.status<300){
				var obj = JSON.parse(xhr.responseText)
				liebiao.innerHTML = baidu.template("moban02",obj)
			}
		}
	}
//	-------------城市切换-------------------
  //点击
  $("#qiehuan").on("click",function(){
  	$("#city").css("display","block")
  })
  
  $("#l-closs").on("click",function(){
  	$("#city").css("display","none")
  })
//---------------获取---------------
$.get("http://localhost:10020/data/chengshi1.json",function(data){
	console.log(data.result.hotcity);
	for(var i = 0 ; i < data.result.hotcity.length ; i++){
		$("<span>"+data.result.hotcity[i].name+"</span>").appendTo($("#c-hot"))
	}
})
//点击替换名字
$("#c-hot span").on("click",function(){
	$(".chengshiming").innerHTML = $(this).html()
})
//------------每个字母开头的名字----------------
$("#city-2 span").on("click",function(){
	$("#city-4 span").remove()
	var ai = $(this).html();
	$(this).css("color","orangered");
	$.get("http://localhost:10020/data/chengshi1.json",function(data){
//	console.log(data.result.citylist);
	var all = data.result.citylist[ai]
//	console.log(all);
	for(var i = 0 ; i < all.length ; i++){
		$('<span>'+all[i].name +'</span>').appendTo($("#city-4"))
	}
})
})





